<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Schema;
class CreateO2oRefundItemTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        $prefix = config('ibrand.app.database.prefix', 'ibrand_');
        if (!Schema::hasTable($prefix . 'o2o_refund_item')) {
            Schema::create($prefix . 'o2o_refund_item', function (Blueprint $table) {
                $table->increments('id');
                $table->integer('refund_id');
                $table->integer('amount');  //退款金额
                $table->integer('quantity');  //退货数量
                $table->integer('order_item_id');  //对应order_item表的ID
                $table->timestamps();
            });
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        $prefix = config('ibrand.app.database.prefix', 'ibrand_');
        
        Schema::drop($prefix . 'o2o_refund_item');
    }
}
